The Dreamweaver JavaScript API > Getting document data through the DOM > dreamweaver.getDocumentDOM() |
![]() ![]() ![]() |
Availability
Dreamweaver 2.0
Description
Provides access to the tree of objects for the specified document. After the tree of objects is returned to the caller, the caller can edit the tree to change the contents of the document.
Arguments
sourceDoc
sourceDoc
must be "document"
, "parent"
, "parent.frames[
number
]"
, "parent.frames['
frameName
']"
, or a URL. document
specifies the document that has the focus and contains the current selection. parent
specifies the parent frameset (if the currently selected document is in a frame), and parent.frames[
number
]
and parent.frames['
frameName
']
specify a document that is in a particular frame within the frameset containing the current document. If the argument is a relative URL, it is relative to the extension file. In Dreamweaver 4, sourceDoc
defaults to document
if omitted.
Note: If the argument is "document"
, the caller must be applyBehavior()
, deleteBehavior()
, objectTag()
, or any function in a command or Property Inspector file in order to perform edits to the document.
Returns
The JavaScript document object at the root of the tree.
Enabler
None.
Example
The following code snippet uses dreamweaver.getDocumentDOM()
to access the background color of the current document:
var theDOM = dreamweaver.getDocumentDOM("document"); theDOM.body.bgcolor = "#000000";
![]() ![]() ![]() |